<?php
  //Loader::loadFile('config.php', 'modules/VoteThailand');
  /**
  * initialise module
  *
  */
  function VoteCanvasser_init() {
    mysql_query("SET NAME UTF8");
    //Create votecanvasser_type table
    if (!DBUtil::createTable('votecanvasser_type')) {
        return false;
    }
    //Create votecanvasser_person table
    if (!DBUtil::createTable('votecanvasser_person')) {
        return false;
    }
    //Create votecanvasser_meeting table
    if (!DBUtil::createTable('votecanvasser_meeting')) {
        return false;
    }
    //Create votecanvasser_meeting table
    if (!DBUtil::createTable('votecanvasser_person_meeting')) {
        return false;
    }
    //Create votecanvasser_person_type table
    if (!DBUtil::createTable('votecanvasser_person_type')) {
        return false;
    }

    //Create votecanvasser_house_no table
    if (!DBUtil::createTable('votecanvasser_house_no')) {
        return false;
    }

    VoteCanvasser_init_folder();
    return true;
  }


  function VoteCanvasser_init_folder(){

    if (!is_dir("pnTemp/votecanvasser_upload/")) {
      mkdir("pnTemp/votecanvasser_upload/", 0755);
    }
    
  }

  function VoteCanvasser_delete() {

    DBUtil::dropTable('votecanvasser_type');
    DBUtil::dropTable('votecanvasser_person');
    DBUtil::dropTable('votecanvasser_meeting');
    DBUtil::dropTable('votecanvasser_person_meeting');
    DBUtil::dropTable('votecanvasser_person_type');
    DBUtil::dropTable('votecanvasser_house_no');

/*
    DROP TABLE `zk_votecanvasser_type`;
    DROP TABLE `zk_votecanvasser_person`;
    DROP TABLE `zk_votecanvasser_meeting`;
    DROP TABLE `zk_votecanvasser_person_meeting`;
    DROP TABLE `zk_votecanvasser_meeting`;
    DROP TABLE `zk_votecanvasser_person_type`;
*/

    return true;
  }